#include<stdio.h>
#include<pthread.h>
#include<unistd.h>

void* thread_run(void* arg)
{
  pthread_detach(pthread_self());
  int id=*(int*)arg;
  while(1)
  {
    printf("%d，当前线程的id:%lu\n",id,pthread_self());
    break;
    sleep(1);
  }
  return (void*)1123;
}

#define NUM 5
int main()
{
  pthread_t tid[NUM];
  void* status=NULL;

  for(int i=0;i<NUM;i++)
  {
  pthread_create(tid+i,NULL,thread_run,(void*)&i);
  sleep(1); 
  }

  sleep(2);
  for(int j=0;j<NUM;j++)
  {
  pthread_join(tid[j],&status);
  printf("%d\n",(int)status);
  }
  sleep(10);
  return 0;
}
